<!-- 订单详情 -->
<template>
  <div class="app-container">
    <el-card>
      <el-row :gutter="24" class="fz-14 tc">
        <el-col :span="4">
          <div class="color6">咨询订单</div>
          <div class="pt-10">{{ form.orderNo || "" }}</div>
        </el-col>
        <el-col :span="3">
          <div class="color6">订单总金额（折后）</div>
          <div class="pt-10">￥{{ form.cost || 0 }}</div>
        </el-col>
        <el-col :span="2">
          <div class="color6">咨询类型</div>
          <div class="pt-10">
            <dict-tag :options="dict.type.calltype" :value="form.callType" />
          </div>
        </el-col>
        <el-col :span="2">
          <div class="color6">发起终端</div>
          <div class="pt-10">{{ form.platform }}</div>
        </el-col>
        <el-col :span="3">
          <div class="color6">会议编号</div>
          <div class="pt-10">{{ form.meetingRoomNumber }}</div>
        </el-col>
        <el-col :span="2">
          <div class="color6">会议发起人</div>
          <div class="pt-10">{{ form.sponsor }}</div>
        </el-col>
        <el-col :span="4">
          <div class="color6">开始时间</div>
          <div class="pt-10">{{ parseTime(form.callTimestart) }}</div>
        </el-col>
        <el-col :span="4">
          <div class="color6">结束时间</div>
          <div class="pt-10">{{ parseTime(form.callTimeend) }}</div>
        </el-col>
      </el-row>
    </el-card>

    <el-table v-loading="loading" :data="detailsList" class="mt-20">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="ID" align="center" prop="id" />
      <el-table-column
        label="咨询子订单"
        align="center"
        prop="no"
        width="150"
      />
      <el-table-column
        label="订单生成时间"
        align="center"
        prop="createTime"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="发起人" align="center" prop="sponsor" />
      <el-table-column label="咨询对象" align="center" prop="expname" />
      <el-table-column label="咨询方式" align="center" prop="roomtype">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.roomtype" :value="scope.row.roomtype" />
        </template>
      </el-table-column>
      <el-table-column
        label="首次进入时间"
        align="center"
        prop="onetime"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.onetime) }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="最后离开时间"
        align="center"
        prop="lasttime"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lasttime) }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="参会总时长"
        align="center"
        prop="duration"
        width="100"
      >
        <template slot-scope="scope">
          <span>{{ scope.row.duration }}分</span>
        </template>
      </el-table-column>
      <el-table-column
        label="应付（原价）"
        align="center"
        prop="oldcost"
        width="100"
      />
      <el-table-column
        label="应付（折后）"
        align="center"
        prop="cost"
        width="100"
      />
      <el-table-column label="实付金额" align="center" prop="cost" />
      <el-table-column
        label="已结算金额"
        align="center"
        prop="billcost"
        width="100"
      />
      <!-- <el-table-column label="支付人" align="center" prop="id" />
      <el-table-column label="支付方式" align="center" prop="id" />
      <el-table-column label="支付时间" align="center" prop="id" /> -->
      <el-table-column label="结算状态" align="center" prop="billStatus">
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.billstatus"
            :value="scope.row.billStatus"
          />
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" width="100px" fixed="right">
        <template slot-scope="scope">
          <el-button
            v-if="scope.row.roomtype !== '1'"
            size="mini"
            type="text"
            icon="el-icon-s-order"
            @click="$router.push(`/order/billingDetails/index/${scope.row.id}?orderId=${form.id}`)"
          >
            结算明细
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getOrderExpList, getOrderInfo } from "@/api/order/order";
export default {
  name: "OrderDetails",
  dicts: ["roomtype", "billstatus", "order_status", "calltype"],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 表单参数
      form: {},
      // 表格数据
      detailsList: [],
    };
  },
  created() {
    const orderId = this.$route.params && this.$route.params.orderId;
    this.getList(orderId);
    this.getOrderInfo(orderId);
  },
  methods: {
    /** 查询咨询详情列表 */
    getList(orderId) {
      this.loading = true;
      getOrderExpList(orderId).then((response) => {
        this.detailsList = response.rows;
        this.loading = false;
      });
    },
    getOrderInfo(orderId) {
      getOrderInfo(orderId).then((res) => {
        this.form = res.data;
      });
    },
  },
};
</script>
